home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 2
/
Amiga Tools 2.iso
/
tex
/
macros
/
source
/
contrib
/
supported
/
supertabular
/
supertabular.doc
< prev
next >
Wrap
Text File
|
1995-03-15
|
30KB
|
832 lines
%%% ====================================================================
%%% @LaTeX-style-file{
%%% author-1 = "Braams J.L.",
%%% author-2 = "Jurriens, T.",
%%% version = "3.7b",
%%% date = "16 May 1994",
%%% time = "16:11:07 MET",
%%% filename = "supertabular.sty",
%%% shortfilename = "supertab.sty"
%%% address-1 = "PTT Research
%%% St. Paulusstraat 4
%%% 2264 XZ Leidschendam
%%% The Netherlands",
%%% address-2 = "Rijksuniversiteit Groningen
%%% P.O. Box 800
%%% 9700 AV Groningen
%%% The Netherlands",
%%% telephone = "(70) 3325051",
%%% FAX = "(70) 3326477",
%%% checksum = "53924 541 2505 23783",
%%% email = "J.L.Braams@research.ptt.nl (Internet)",
%%% codetable = "ISO/ASCII",
%%% keywords = "",
%%% supported = "yes",
%%% abstract = "A style optioin that implements multi-page
%%% tables. The tables have their natural
%%% widths on the subsequent pages.",
%%% docstring = "The checksum field above contains a CRC-16
%%% checksum as the first value, followed by the
%%% equivalent of the standard UNIX wc (word
%%% count) utility output of lines, words, and
%%% characters. This is produced by Robert
%%% Solovay's checksum utility.",
%%% }
%%% ====================================================================
%
% ===> This file can NOT YET be run through LaTeX with the doc option <==
%
% supertabular sty
% original idea: Theo Jurriens 1988
% jurriens@fwn.rug.nl P.O Box 800, 9700 AV Groningen
%
% revised by: Johannes Braams
% J.L.Braams@research.ptt.nl PTT Research Leidschendam (NL)
% \def\fileversion{3.7a}
% \def\filename{supertabular sty}
% \def\filedate{1994/05/16}
%
% \changes{v3.7b}{1994/05/16}{Rewrote the page break deciding
% algorithm again}
% \changes{v3.7b}{1994/05/16}{Started to convert to dtx format}
%
% 05.04.93 - Supertabular didn't work correctly in twocolumn mode.
% V 3.7a Rewrote the mechanism for establishing the amount of
% space that supertabular can use. This still needs further
% thought. The algorithm to compute the places to break
% the table is still a bit fragile, especially when p{}
% columns are used.
% 10.07.92 - Still a problem in the combination of supertabular with array.sty
% V 3.6h I overlooked the fact that array doesn't use \@tabulacr anymore
% and it behaves differently with respect to \@startparbox.
% 03.07.92 - A problem in the combination of supertabular with array.sty
% V 3.6g It can be solved by removing the \string from \def\tableformat
% and passing \tableformat expanded to \tabular.
% 11.02.92 - Bug found by Michael Heissmeier when p{...} is used.
% V 3.6f A change in LaTeX.tex didn't find its way into supertabular.
% 01.08.91 - Take height of tabletail into account when computing the
% V 3.6e maximum tableheight; add tolerance on first (partial) page
% of the supertabular.
% 27.06.91 - Cured bug that made the first part of the table one line
% V 3.6d shorter than the others. Appeared when supertabular was
% used in a twocolumn environment.
% 26.06.91 - Made \@process@tablecaption a global macro. Previous caption
% V 3.6c turned up on a table without one.
% 27.05.91 - Replaced \clearpage with \newpage to make supertabulars work
% V 3.6b in a twocolumn environment. This also prevents all floats
% from being printed.
% 15.02.91 - Because of the check for the use of tablefirsthead the
% V 3.6a combination of an \hline in the head and an \hline as the first
% thing in the data went wrong. The \futurelet in the definition
% of \hline found \fi instead of \hline, so no \doublerulesep
% was added.
% Also had to modify the way the environments were defined.
% The blank space (from the CR after the argument of \supertabular)
% has to be gobbled. This can only be done using a construction
% like \def\command#1 {...}. So removed the use of \newenvironment
% 04.02.91 - Added the commands \topcaption, \bottomcaption and \tablecaption
% V 3.6 to include a caption within the supertabular environment. The
% default behaviour is to put the caption before the actual start
% of the table.
% - Also added \tablefirsthead and \tablelasttail to let the
% user specify a different head for the first page of the table
% and for consecutive pages as well as different tails for first
% pages and the last one. If these commands are not used, the
% default behaviour will be to use the value of \tablehead end
% \tabletail
% - Removed the need for the \noalign{\global\let\\=\@stabularcr}
% commands by storing and resetting \@stabularcr
%
% 16.10.90 Added the supertabular* environment that was in an earlier
% V 3.5 version (2.0) by the original author
% Reintroduced the version numbering
%
% revised by: Gabriele Kruljac
% kruljac@ds0mpi11 Max-Planck-Institute Stuttgart
%
%
% 06.06.89 Correction: now care is taken of probably existing onecolumn
% head (title or tables ...) in twocolumn sty.
%
% 10.05.89 Correction: the new \\ definition has been added to the
% begin of each `sub'-tabular
% Added: algorithm to produce the tabulars in twocolumn style
%
% 06.04.89 Correction: put \global statement in \end{supertabular}
% into \noalign
%
% 22.02.89 Correction: restore the original meaning of \\ with
% \end{supertabular}
%
% (Feb 89) The whole algorithm has been changed, so that I can use
% the most features of a normal tabular:
% \\ for new line, including \\[#1]
% p{...} in the preamble ...
% Account is taken to \baselinestretch and \arraystretch
% -I'm not counting the lines because of too much rounding errors
% but instead I add the (estimated) used space in pt.
% -The tablehead is taken into this algorithm of proofing, so
% I really know how much space the head uses.
% -When no p-arg is given I add a variable \midlineheight to
% calculate the used space. To calculate \midlineheight I
% take the \baselineskip, which is active when the supertabular
% starts (\baselineskip includes the \value of \baselinestretch)
% and multiply it with \arraystretch.
% -When a p-arg is given the text will be stored in a box. So
% I know the height I have to add. Also I reduce the maximum
% pagesize, so that the last parbox on a page can get up to
% max 4 lines without producing an overfull vbox.
% -To do so I had to make some additions to LaTeX's tabular
% commands. These new commands got a leading `s'.
%
% Weak points:
% -When the material of a normal entry (not a p-arg) becomes
% larger than the estimated \midlineheight, overfull vboxes
% will be produced at all.
% -When the last p-arg on a page gets more than 4 lines
% (probably even more than 3 lines) it will result in an
% overfull vbox.
% Also some combinations of \baselinestretch \arraystretch and
% a large font may lead to one line too much.
% -if accidentally the last line of the tabular produces
% a newpage, on the next page the tabletail will be written
% immediately after the tablehead. Depending on the contents
% this may result in an error message regarding misplaced
% \noalign.
%
% A quick but not very elegant solution: shrink \maxsize by
% \noalign{\global\maxsize=...pt} after the first \\ of the
% supertabular.
%
%------------------------------------------------------------------------------
% \begin{macro}{\topcaption}
% \begin{macro}{\bottomcaption}
% The user-commands |\topcaption| and |\bottomcaption| set the
% boolean |@topcaption| to determine where to put the
% tablecaption. The default is to put the caption on the top of
% the table
% \begin{macrocode}
% \begin{macrocode}
\newif\if@topcaption \@topcaptiontrue
\def\topcaption{\@topcaptiontrue\tablecaption}
\def\bottomcaption{\@topcaptionfalse\tablecaption}
% \end{macrocode}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\tablecaption}
% This command has to function exactly like |\caption| does except
% it has to store its argument (and the optional argument) for
% later processing \emph{within} the supertabular environment.
%
% \begin{macrocode}
\long\def\tablecaption{%
\refstepcounter{table} \@dblarg{\@xtablecaption}}
\long\def\@xtablecaption[#1]#2{%
\long\gdef\@process@tablecaption{\@stcaption{table}[#1]{#2}}}
\global\let\@process@tablecaption\relax
% \end{macrocode}
% \end{macro}
%
% This is a redefinition of LaTeX's \@caption, \@makecaption is
% called within a group so as not to return to \normalsize globally.
% also a fix is made for the `feature' of the \@makecaption of article.sty and
% friends that a caption ALWAYS gets a \vskip 10pt at the top and NONE at the
% bottom. If a user wants to precede his table with a caption this results
% in a collision.
%
% \begin{macrocode}
\long\def\@stcaption#1[#2]#3{\par%
\addcontentsline{\csname ext@#1\endcsname}{#1}%
{\protect\numberline{%
\csname the#1\endcsname}{\ignorespaces #2}}
\begingroup
\@parboxrestore
\normalsize
\if@topcaption \vskip -10pt \fi
\@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
\if@topcaption \vskip 10pt \fi
\endgroup}
% \end{macrocode}
%
% |\tablehead| activates the new tabular |\cr| commands.
% \begin{macrocode}
\newcommand\tablehead[1]{\gdef\@tablehead{#1}}
\tablehead{}
\newcommand\tablefirsthead[1]{\gdef\@table@first@head{#1}}
% \end{macrocode}
%
%
% If the user uses an extra amount of tabular-data (like
% \|multicolumn|) in |\tabletail| \TeX\ starts looping because of
% the definition of |\nextline|. So make |\\| act like just a |\cr|
% inside this tail to prevent the loop. Save and restore the value
% of |\\|
%
% \begin{macrocode}
\newcommand\tabletail[1]{%
\gdef\@tabletail{%
\noalign{%
\global\let\@savcr=\\
\global\let\\=\cr}%
#1%
\noalign{\global\let\\=\@savcr}}}
\tabletail{}
\newcommand\tablelasttail[1]{\gdef\@table@last@tail{#1}}
% \end{macrocode}
%
% \begin{macro}{\sttraceon}
% \changes{v3.7b}{1994/05/16}{Added macro}
% \begin{macro}{\sttraceoff}
% \changes{v3.7b}{1994/05/16}{Added macro}
% There now is a possiblity to follow the decisions supertabular
% makes about breaking the tabular. This has to be enabled when
% converting this file with \texttt{docstrip} to a \texttt{.sty}
% file.
% \begin{macrocode}
%<tracing>\newif\if@st@trace
%<tracing>\newcommand\sttraceon{\@st@tracetrue}
%<tracing>\newcommand\sttraceoff{\@st@tracefalse}
%<tracing>\newif\if@st@trace
% \end{macrocode}
% The default is to turn tracing off
% \begin{macrocode}
%<tracing>\sttraceoff
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\@sttrace}
% A macro that gets the trace message as its argument
% \begin{macrocode}
%<tracing>\newcommand\@sttrace[1]{\if@st@trace\typeout{ST trace: #1}\fi}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\page@left}
% \changes{v3.7b}{1994/05/16}{Renamed from \cmd\maxsize}
% This register holds the estimate of the amount of space left over
% on the current page. This is used in the decision when to start a
% new page.
% \begin{macrocode}
\newdimen\page@left
% \end{macrocode}
% \end{macro}
%
% \begin{macrocode}
\newdimen\actsize % actual pagesize
\newdimen\@tailht % height of table tail (if any)
\newdimen\parboxheight % height plus depth of a parbox-argument
\newdimen\addspace % stores the value of \\[#1]
\newdimen\midlineheight % estimated size of a normal line
\newdimen\pargcorrection % to set page height tolerance if p-arg
\newdimen\computedimens % computation variable
\newbox\tabparbox
% \end{macrocode}
%
% \begin{macro}{\@stabularcr}
% \begin{macro}{\@sxtabularcr}
% These are redefinitions of |\@tabularcr| and |\@xtabularcr|. This
% is needed to include |\nextline| in the definition of
% |\@xtabularcr|.
%
% All redefined macros have names that are similar to the original
% names, except with a leading 's'
% \begin{macrocode}
\def\@stabularcr{{\ifnum0=`}\fi\@ifstar{\@sxtabularcr}{\@sxtabularcr}}
\def\@sxtabularcr{%
\@ifnextchar[{\@sargtabularcr}{\ifnum0=`{\fi}\cr\nextline}}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macrocode}
\def\@sargtabularcr[#1]{%
\ifnum0=`{\fi}%
\ifdim #1>\z@
\unskip\@sxargarraycr{#1}
\else
\@syargarraycr{#1}%
\fi}
% \end{macrocode}
%
% In this case we need to copy the value of the optional argument
% of |\\| in our private register |\addspace|.
% \begin{macrocode}
\def\@sxargarraycr#1{%
\@tempdima #1\advance\@tempdima \dp \@arstrutbox
\vrule \@height\z@ \@depth\@tempdima \@width\z@ \cr
\noalign{\global\addspace=#1}\nextline}
% \end{macrocode}
%
% Here we need to insert |\nextline|
% \begin{macrocode}
\def\@syargarraycr#1{\cr\noalign{\vskip #1\global\addspace=#1}\nextline}
% \end{macrocode}
%
% The macros that deal with parbox columns need to be redefined,
% because we need to know the size of the parbox. Also the maximum
% size of the tabular on this page is shrunk somewhat.
% \begin{macrocode}
\def\@sstartpbox#1{%
\global\advance\page@left by -\pargcorrection
\global\pargcorrection=0pt
% \end{macrocode}
% To achieve our goal we need to save the text in box.
% \begin{macrocode}
\setbox\tabparbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
% \end{macrocode}
%
% \begin{macrocode}
\def\@sastartpbox#1{%
\bgroup\hsize#1%
\global\advance\page@left by -\pargcorrection
\global\pargcorrection=0pt
\setbox\tabparbox\vtop\bgroup\hsize#1\@arrayparboxrestore}
% \end{macrocode}
%
% 11/03/92 JB: The following change didn't find its way into the
% \@sendpbox command. This caused a difference in linespacing
% between a supertabular and a normal tabular.
% \def\@endpbox{\unskip\strut\par\egroup\hfil}
% % 14 Jan 89: Def of \@endpbox changed from
% % \def\@endpbox{\par\vskip\dp\@arstrutbox\egroup\hfil}
% % so vertical spacing works out right if the last line of a `p' entry
% % has a descender.
% \begin{macrocode}
\def\@sendpbox{%
\unskip\strut\par\egroup
\computedimens=\ht\tabparbox
\advance\computedimens by \dp\tabparbox
\ifnum\parboxheight<\computedimens
\global\parboxheight=\computedimens
\fi
\computedimens=\z@
\box\tabparbox\hfil}
\def\@saendpbox{%
\unskip\strut\par\egroup
\computedimens=\ht\tabparbox
\advance\computedimens by \dp\tabparbox
\ifnum\parboxheight<\computedimens
\global\parboxheight=\computedimens
\fi
\computedimens=\z@
\unvbox\tabparbox\egroup}
% \end{macrocode}
%
% %%%% Here start really new supertabular commands %%%%
%
% \begin{macro}{\calmidlineheight}
% Estimates the height of normal line taking |\arraystretch| into
% account.
% \begin{macrocode}
\def\calmidlineheight{%
\midlineheight=\arraystretch \baslineskp
\global\advance\midlineheight by 1\p@
%<tracing> \@sttrace{Average line height:\the\midlineheight}%
\global\pargcorrection=4\midlineheight
%<tracing> \@sttrace{Correction for p columns: \the\pargcorrection}%
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@calfirstpageht}
% \changes{v3.7a}{1993/04/05}{Renamed from \cmd\calpage}
% Estimates the space left on the current page and decides whether
% the tabular can be started on this page or on a new page.
% \begin{macrocode}
\def\@calfirstpageht{%
%<tracing> \@sttrace{Calculating height of tabular on first page}
% \end{macrocode}
% The \TeX\ register |\pagetotal| contains the height of the page
% sofar, the \LaTeX\ register |\@colroom| contains the height of
% the column.
% \begin{macrocode}
\global\actsize\pagetotal
\global\page@left\@colroom
%<tracing> \@sttrace{pagetotal = \the\pagetotal;
%<tracing> page@left = \the\page@left}%
% \end{macrocode}
% When we are in twocolumn mode \TeX\ may still be collecting
% material for the first column although there seems to be no space
% left. In this case we have to check against two times |\page@left|.
% \begin{macrocode}
\if@twocolumn
%<tracing> \@sttrace{two column mode}%
\if@firstcolumn
%<tracing> \@sttrace{First column}%
\ifnum\actsize > \page@left
\global\maxsize=2\page@left
\ifnum\actsize > \page@left
\newpage\@calnextpageht
%<tracing> \@sttrace{starting new page}%
\else
% \end{macrocode}
% In this case we're in the second column, so we have to compensate
% for the material in the first column.
% \begin{macrocode}
%<tracing> \@sttrace{Second column}%
\global\advance\page@left -\actsize
\global\advance\page@left -\@colroom
\fi
\fi
\fi
\else
% \end{macrocode}
% In one column mode there is a simple decision.
% \begin{macrocode}
%<tracing> \@sttrace{one column mode}%
\ifnum\actsize > \page@left
%<tracing> \@sttrace{starting new page}%
\newpage\@calnextpageht
% \end{macrocode}
% When we are not starting a new page subtract the size of the
% material already on it from the available space.
% \begin{macrocode}
\else
\global\advance\page@left by -\actsize
\global\actsize\z@
\fi
\fi
% \end{macrocode}
% To decide when to start a new page, we need to know the vertical
% size of the tail of the table.
% \begin{macrocode}
\ifx\empty\@tabletail
\@tailht=\z@
\else
\setbox\@tempboxa=\vbox{\@arrayparboxrestore%
\expandafter\tabular\expandafter{\tableformat}
\@tabletail\endtabular}
\@tailht=\ht\@tempboxa\advance\@tailht\dp\@tempboxa
\fi
% \end{macrocode}
% We add the average height of a line to this because when we
% decide to continue the tabular we need to have enough space left
% for one line an the tail.
% \begin{macrocode}
\advance\@tailht by \midlineheight
%<tracing> \@sttrace{Height of tail: \the\@tailht}
%<tracing> \@sttrace{Maximum height of tabular: \the\page@left}
}
% Here is the definition of supertabular
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@calnextpageht}
% \changes{v3.7a}{1993/04/05}{Macro added}
% This calculates the maximum height of the tabular on all
% subsequent pages of the supertabular environment. The correction
% for parbox columns is somewhat smaller then on the first page of
% the environment
% \begin{macrocode}
\def\@calnextpageht{%
%<tracing> \@sttrace{Calculating height of tabular on next page}
\global\page@left\@colroom
\global\pargcorrection=2\midlineheight
%<tracing> \@sttrace{Correction for p columns: \the\pargcorrection}%
\global\actsize=\z@
%<tracing> \@sttrace{Maximum height of tabular: \the\page@left}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\supertabular}
% We start by saving the preamble of the tabular in a macro.
% \begin{macrocode}
\def\supertabular#1 {%
\def\tableformat{#1}
%<tracing> \@sttrace{Starting a new supertabular}
% \end{macrocode}
% Then remember that this is not a \textsf{supertabular*}
% environment.
% \begin{macrocode}
\global\starfalse
% \end{macrocode}
% If the caption should come at the top we insert it here.
% \begin{macrocode}
\if@topcaption \@process@tablecaption \fi
% \end{macrocode}
% Save the original definition of |\\|.
% \begin{macrocode}
\global\let\@oldcr=\\
% \end{macrocode}
% Save the current value of |\baselineskip|, as we need it in the
% calculation of the average height of a line.
% \begin{macrocode}
\def\baslineskp{\baselineskip}%
\calmidlineheight
\@calfirstpageht
% \end{macrocode}
% We have to check whether \texttt{array.sty} was loaded, because
% some of the internal macros have different names.
% \begin{macrocode}
\ifx\undefined\@classix
% \end{macrocode}
% Save old |\@tabularcr| and insert the definition of
% |\@stabularcr|.
% \begin{macrocode}
\let\@@tabularcr\@tabularcr
\let\@tabularcr\@stabularcr
% \end{macrocode}
% Activate the new parbox algorithm.
% \begin{macrocode}
\let\@@startpbox=\@sstartpbox
\let\@@endpbox=\@sendpbox
\else
% \end{macrocode}
% When \texttt{array.sty} was loaded things are a bit different.
% \begin{macrocode}
\let\@@tabularcr\@arraycr
\let\@arraycr\@stabularcr
\let\org@startpbox=\@startpbox
\let\org@endpbox=\@endpbox
\let\@startpbox=\@sastartpbox
\let\@endpbox=\@saendpbox
\fi
% \end{macrocode}
%
% Moved the check for the use of \tablefirsthead to befor the start of
% the tabular environment in order to make the \futurelet inside \hline
% do its work correctly (15.02.91)
%
% Check if the head of the table should be different for the first
% and subsequent pages.
% \begin{macrocode}
\ifx\@table@first@head\undefined
\let\@@tablehead=\@tablehead
\else
\let\@@tablehead=\@table@first@head
\fi
% \end{macrocode}
% Finally start a normal \textsf{tabular} environment.
% \begin{macrocode}
\expandafter\tabular\expandafter{\tableformat}
\@@tablehead}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endsupertabular}
% This closes the environment.
% \begin{macrocode}
\def\endsupertabular{%
\ifx\@table@last@tail\undefined
\@tabletail
\else
\@table@last@tail
\fi
\endtabular
% \end{macrocode}
% Restore the original definition of |\@tabularcr|
% \begin{macrocode}
\ifx\undefined\@classix
\let\@tabularcr\@@tabularcr
\else
\let\@arraycr\@@tabularcr
\let\@startpbox=\org@startpbox
\let\@endpbox=\org@endpbox
\fi
% \end{macrocode}
% Check if we have to insert a caption and restore to default
% behaviour of putting captions at the top.
% \begin{macrocode}
\if@topcaption
\else
\@process@tablecaption
\@topcaptiontrue
\fi
% \end{macrocode}
%
% Restore the meaning of |\\| to the one it had before the start
% of this environment. Also re-initialize some control-sequences
%
% \begin{macrocode}
\global\let\\=\@oldcr
\let\@table@first@head\undefined
\let\@table@last@tail\undefined
\global\let\@process@tablecaption\relax
%<tracing> \@sttrace{Ended a supertabular}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifstar}
% This switch is used in the internal macros to remember which
% kind of environment was started.
% \begin{macrocode}
\newif\ifstar
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\tabularwidth}
% For the \textsf{supertabular*} environment it is necessary to
% store the intended width of the tabular.
% \begin{macrocode}
\newdimen\tabularwidth
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\supertabular*}
% We start by saving the intended width and the preamble of the
% \textsf{tabular*}.
% \begin{macrocode}
\@namedef{supertabular*}#1#2 {%
%<tracing> \@sttrace{Starting a new supertabular*}
\def\tableformat{#2}
\tabularwidth=#1
\global\startrue
% \end{macrocode}
% If the caption should come at the top we insert it here.
% \begin{macrocode}
\if@topcaption\@process@tablecaption\fi
% \end{macrocode}
% Save the original definition of |\\|.
% \begin{macrocode}
\global\let\@oldcr=\\
% \end{macrocode}
% Save the current value of |\baselineskip|, as we need it in the
% calculation of the average height of a line.
% \begin{macrocode}
\def\baslineskp{\baselineskip}%
\calmidlineheight
\@calfirstpageht
% \end{macrocode}
% We have to check whether \texttt{array.sty} was loaded, because
% some of the internal macros have different names.
% \begin{macrocode}
\ifx\undefined\@classix
% \end{macrocode}
% Save old |\@tabularcr| and insert the definition of
% |\@stabularcr|.
% \begin{macrocode}
\let\@@tabularcr\@tabularcr
\let\@tabularcr\@stabularcr
% \end{macrocode}
% Activate the new parbox algorithm
% \begin{macrocode}
\let\@@startpbox=\@sstartpbox
\let\@@endpbox=\@sendpbox
\else
% \end{macrocode}
% When \texttt{array.sty} was loaded things are a bit different.
% \begin{macrocode}
\let\@@tabularcr\@arraycr
\let\@arraycr\@stabularcr
\let\org@startpbox=\@startpbox
\let\org@endpbox=\@endpbox
\let\@startpbox=\@sastartpbox
\let\@endpbox=\@saendpbox
\fi
% \end{macrocode}
%
% Check if the head of the table should be different for the first
% and subsequent pages.
% \begin{macrocode}
\ifx\@table@first@head\undefined
\let\@@tablehead\@tablehead
\else
\let\@@tablehead\@table@first@head
\fi
% \end{macrocode}
% Finally start a normal \textsf{tabular*} environment.
% \begin{macrocode}
\expandafter\csname tabular*\expandafter\endcsname
\expandafter{\expandafter\tabularwidth\expandafter}%
\expandafter{\tableformat}%
\@@tablehead}%
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\endsupertabular*}
% This closes the environment.
% \begin{macrocode}
\@namedef{endsupertabular*}{%
\ifx\@table@last@tail\undefined
\@tabletail
\else
\@table@last@tail
\fi
\csname endtabular*\endcsname
% \end{macrocode}
% Restore the old definition of |\@tabularcr|.
% \begin{macrocode}
\ifx\undefined\@classix
\let\@tabularcr\@@tabularcr
\else
\let\@arraycr\@@tabularcr
\let\@startpbox=\org@startpbox
\let\@endpbox=\org@endpbox
\fi
% \end{macrocode}
% Check if we have to insert a caption and restore to default
% behaviour of putting captions at the top.
% \begin{macrocode}
\if@topcaption
\else
\@process@tablecaption
\@topcaptiontrue
\fi
% \end{macrocode}
%
% Restore the meaning of |\\| to the one it had before the start
% of this environment. Also re-initialize some control-sequences
%
% \begin{macrocode}
\global\let\\=\@oldcr
\let\@table@first@head\undefined
\let\@table@last@tail\undefined
\global\let\@process@tablecaption\relax
%<tracing> \@sttrace{Ended a supertabular*}
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\nextline}
% This macro is called by each |\\| inside the tabular environment.
% It updates the estimate of the amount of space left on the
% current page and starts a new page if necessary.
% \begin{macrocode}
\def\nextline{%
\noalign{%
\ifnum\parboxheight<\midlineheight
% \end{macrocode}
% If there is a non-empty line, but an empty parbox, then
% |\parboxheight| might be non-zero, but too small thereby breaking
% the algorithm. Therefore we estimate the height of the line to be
% |\midlineheight| in this case.
% \begin{macrocode}
\global\advance\page@left -\midlineheight
% \end{macrocode}
% |\addspace| is the value of the optional argument of |\\|.
% \begin{macrocode}
\global\advance\page@left -\addspace
\else
% \end{macrocode}
% When the parbox was not empty we take into account its height
% (plus a bit extra).
% \begin{macrocode}
%<tracing> \@sttrace{Added par box with height \the\parboxheight}%
\global\advance\page@left -\parboxheight
\global\advance\page@left -0.1\parboxheight
\global\parboxheight\z@
\fi
\global\addspace=\z@
%<tracing> \@sttrace{Space left for tabular: \the\page@left}
}
% \end{macrocode}
% When there is not enough space left we start a new page.
% \begin{macrocode}
\ifnum\page@left<\@tailht
\st@newpage
\else
% \end{macrocode}
%
% This line is necessary because the tablehead has to be inserted
% *after* the |\if\else\fi|-clause. For this purpose |\st@next| is
% used. In the middle of tableprocessing it shoud be an *empty*
% macro (*not* |\relax|). (15.2.91)
% \begin{macrocode}
\noalign{\global\let\st@next\@empty}%
\fi\st@next}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\st@newpage}
% \changes{v3.7b}{1994/05/16}{Added macro, split off from
% \cmd\nextline}
% This macro performs the actions necessary to start a new page.
% \begin{macrocode}
\def\st@newpage{%
%<tracing> \noalign{\@sttrace{Starting new page, writing tail}}
% \end{macrocode}
% Output |\tabletail|, close the tabular environment, output all
% material and start a fresh new page.
% \begin{macrocode}
\@tabletail
\ifstar
\csname endtabular*\endcsname
\else
\endtabular
\fi
% \if@twocolumn
% \if@firstcolumn
% \newpage\@calnextpageht
% \global\actsize=\z@
% \else
% \newpage\@calnextpageht
% \fi
% \else
\newpage\@calnextpageht
% \fi
\let\st@next\@tablehead
%<tracing> \@sttrace{writing head}
\ifstar
\expandafter\csname tabular*\expandafter\endcsname
\expandafter{\expandafter\tabularwidth\expandafter}%
\expandafter{\tableformat}%
\else
\expandafter\tabular\expandafter{\tableformat}%
\fi}
% \end{macrocode}